package com.example.projectone;

import android.app.Activity;
import android.content.Intent;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.support.v4.app.FragmentActivity;

public class BaseActivity extends FragmentActivity {
	
	private final String TAG = "Base Activity";
	
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}


	@Override
	public boolean onOptionsItemSelected(MenuItem item)
	{
		switch (item.getItemId())
		{
			case R.id.trafikkmeldinger:
				Intent trafficIntent = new Intent(getApplicationContext(), TrafficActivity.class);
				startActivityForResult(trafficIntent, 0);
				overridePendingTransition(R.anim.fadein, R.anim.fadeout);
				Log.i(TAG, "trafikkmeldinger item clicked");
			return true;
			case R.id.kart:
				Intent mapIntent = new Intent(getApplicationContext(), MapActivity.class);
				startActivityForResult(mapIntent, 0);
				overridePendingTransition(R.anim.fadein, R.anim.fadeout);
				Log.i(TAG, "kart item clicked");
			return true;
			case R.id.rute:
				Intent routeIntent = new Intent(getApplicationContext(), RouteActivity.class);
				startActivityForResult(routeIntent, 0);
				overridePendingTransition(R.anim.fadein, R.anim.fadeout);
				Log.i(TAG, "rute item clicked");
			return true;
			case R.id.innstillinger:
				Intent settingsIntent = new Intent(getApplicationContext(), SettingsActivity.class);
				startActivityForResult(settingsIntent, 0);
				overridePendingTransition(R.anim.fadein, R.anim.fadeout);
				Log.i(TAG, "innstillinger item clicked");
			return true;	
			
			default:
				return super.onOptionsItemSelected(item);
		}
	}

}
